import request from '@/utils/request'

/**
 * 分页查询
 *
 * @param noticeConfig noticeConfig
 * @param paginator paginator
 * @returns {*}
 */
export async function noticeConfigQuery(noticeConfig, paginator) {
  return await request({
    url: '/ddk/noticeConfig/query',
    method: 'post',
    data: {
      'noticeConfig': noticeConfig,
      'paginator': paginator
    }
  })
}

/**
 * 保存
 *
 * @param noticeConfig noticeConfig
 * @returns {*}
 */
export async function saveNoticeConfig(noticeConfig) {
  return await request({
    url: '/ddk/noticeConfig/save',
    method: 'post',
    data: noticeConfig
  })
}

/**
 * remoteValidateNoticeConfigName
 *
 * @param noticeConfigName noticeConfigName
 * @returns {*}
 */
export async function remoteValidateNoticeConfigName(noticeConfigName) {
  return await request({
    url: '/ddk/noticeConfig/validateNoticeConfigName/' + noticeConfigName,
    method: 'get'
  })
}

/**
 * remoteValidateNoticeConfigResource
 *
 * @param noticeConfigSource noticeConfigSource
 * @returns {*}
 */
export async function remoteValidateNoticeConfigResource(noticeConfigSource) {
  return await request({
    url: '/ddk/noticeConfig/validateNoticeConfigSource/' + noticeConfigSource,
    method: 'get'
  })
}


/**
 * 发布
 *
 * @param resource resource
 * @param value value
 * @returns {*}
 */
export async function publishResource(resource, value) {
  return await request({
    url: '/ddk/webapi/publish',
    method: 'post',
    data: {
      'resource': resource,
      'value': value,
    }
  })
}
